<template>
	<view>
		<view>two页面</view>
		<button type="primary" @click="toOne">toOne</button>
		<rate></rate>
		<icon 
		type="star" 
		color='#ececec' 
		size='24'></icon>
		<!-- <section 
		type='circle'
		title='section' 
		subTitle='subTitle'>sssssssssssssssssssss</section> -->
	</view>
</template>

<script>
	import icon from "../../components/uni-icons/uni-icons.vue"
	import rate from "../../components/uni-rate/uni-rate.vue"
	import section from "../../components/uni-section/uni-section.vue"
	
	export default {
		data() {
			return {
				
			}
		},
		components:{
				icon,rate
		},
		onLoad() {
			this.testRequest()
		},
		methods: {
			toOne(){
				
				uni.redirectTo({
					url:"../one/one"
				})
				
			},
			testRequest(){
				// uni 中使用ajax
				uni.request({
					url:"https://bird.ioliu.cn/weather",
					header:{
						'token':'xxx' // header中添加参数
					},
					data:{
						city:'枝江' // 参数
					},
					success: (res) => {
						console.log(res.data)
						// vuex如果分为几个模块，方法是在模块中的话，如果直接在组件中通过this.$store.commit("方法名")是获取不到，
						// 必须要在前面加上模块名，如this.$store.commit("模块名/方法名")才可以获取到
						this.$store.commit('user/SET_WEATHER', res.data)
						// this.$store.state.weather = res.data
					}
				})
			}
		}
	}
</script>

<style>

</style>
